home *** CD-ROM | disk | FTP | other *** search
- /*
- File: MacFramework.h
-
- Contains: Basic Macintosh Functions for Window, Menu handling and similar things.
-
- Written by: DTS
-
- Copyright: © 1994-1995 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <1> 12/20/94 khs first file
-
- */
-
-
- #pragma once
-
-
- // INCLUDES
- #include <Movies.h>
- #include <stdio.h>
- #include <TextUtils.h>
- #include <Memory.h>
-
- #ifdef __MWERKS__
- #include <sioux.h>
- #endif // __MWERKS__
-
-
- // ENUMS, DEFINES AND GLOBALS
- enum { kMovieControllerObject = 'MCOb'
- };
-
-
-
- // MACROS
- //#if DEBUG
- //static char gAppDebugString[256];
- //
- //#define DebugAssert(condition) \
- // if (condition) NULL; \
- // else \
- // { \
- // sprintf(gAppDebugString,"File: %s, Line: %d", __FILE__, __LINE__); \
- // DebugStr(c2pstr(gAppDebugString)); \
- // }
- //#else
- //#define DebugAssert(condition) NULL
- // #endif
-
-
- // ENUMS
- // MENUS
- enum eMenubar { mMenubar = 128};
-
- enum eMainMenus {
- mApple = 128, mFile, mEdit
- };
-
- enum eAppleMenu {
- iAbout = 1
- };
-
- enum eFileMenu{
- iNew = 1, iOpen, iClose, iSave, iSaveAs, iPrint =7, iQuit = 9
- };
-
- enum eEditMenu {
- iUndo = 1, iCut = 3, iCopy, iPaste, iClear, iSelectAll = 8
- };
-
- // DIALOGS
- enum eDialogs {
- kAboutBox = 128, kAlertError = 129
- };
-
-
- // TYPEDEFS AND STRUCTURES
- // WindowObjectRecord/Ptr is a data structure attached to the movie window. Use
- // this structure if you want to associate any data with any window presented.
-
- typedef struct {
- OSType ObjectType; // specific tag indicating that the window object belongs to our application
- MovieController controller;
- Rect originalSize; // including movie controller
- FSSpec FileFSSpec;
- short FileResID;
- short FileRefNum;
-
- // add more elements if needed
- } WindowObjectRecord, *WindowObjectPtr, **WindowObject;
-
-
- // FUNCTION PROTOTYPES
-
- // PURE MAC TOOLBOX FUNCTIONS
- void InitStack(long extraStackSpace);
- void InitMacEnvironment(long nMoreMasters);
- pascal void AppGrowZoneCallback(void);
-
- Boolean InitMenubar(void);
- void HandleMenuCommand(long theMenuResult);
- void AdjustMenus(void);
- void MainEventLoop(void);
-
- Boolean IsAppWindow(WindowRef theWindow);
- WindowObject CreateWindowObject(WindowRef theWindow);
-
- void HandleKeyPress(EventRecord *theEvent);
- void ShowAboutDialogBox(void);
- void ShowWarning(Str255 theMessage, OSErr theErr);
-
- // MOVIE RELATED TOOLBOX FUNCTIONS
- MovieController GetMCFromFrontWindow(void);
- Boolean IsWindowObjectOurs(WindowObject theObject);
- Boolean DoCreateNewMovie(void);
- MovieController SetupMovieWindowWithController(Movie theMovie, WindowRef theWindow);
- Boolean DoCreateMovieWindow(Movie theMovie);
- void DoDestroyMovieWindow(WindowRef theWindow);
- void DoActivateWindow(WindowRef theWindow, Boolean becomingActive);
- Boolean DoUpdateMovieFile(WindowRef theWindow);
-
-
- // APPLICATION SPECIFIC FUNCTIONS
- // These are placed in the MacApplication.c file, you could override these for changing
- // the behavior of the function in a specific application.
-
- void DoIdle(WindowRef theWindow);
- void DoUpdateWindow(WindowRef theWindow, Rect *theRefrehArea);
- void HandleContentClick(WindowRef theWindow, EventRecord *theEvent);
- WindowRef CreateMovieWindow(Rect *theRect, Str255 theTitle);
- void AddControllerFunctionality(MovieController mc);
- void HandleApplicationMenu(short theMenuID, short theMenuItem);
- void AdjustApplicationMenus(void);
-
-
-
-